Other Classes

The following classes are available globally.

  • Information about an attribution statement, usually a copyright or trademark statement, associated with a map content source.

    See more

    Declaration

    Objective-C

    
    @interface MGLAttributionInfo : NSObject

    Swift

    class MGLAttributionInfo : NSObject
  • The options to use when creating images with the MGLMapSnapshotter.

    See more

    Declaration

    Objective-C

    
    @interface MGLMapSnapshotOptions : NSObject

    Swift

    class MGLMapSnapshotOptions : NSObject
  • An image generated by a snapshotter object.

    See more

    Declaration

    Objective-C

    
    @interface MGLMapSnapshot : NSObject

    Swift

    class MGLMapSnapshot : NSObject
  • An MGLMapSnapshotter generates static raster images of the map. Each snapshot image depicts a portion of a map defined by an MGLMapSnapshotOptions object you provide. The snapshotter generates an MGLMapSnapshot object asynchronously, passing it into a completion handler once tiles and other resources needed for the snapshot are finished loading.

    You can change the snapshotter’s options at any time and reuse the snapshotter for multiple distinct snapshots; however, the snapshotter can only generate one snapshot at a time. If you need to generate multiple snapshots concurrently, create multiple snapshotter objects.

    For an interactive map, use the MGLMapView class. Both MGLMapSnapshotter and MGLMapView are compatible with offline packs managed by the MGLOfflineStorage class.

    From a snapshot, you can obtain an image and convert geographic coordinates to the image’s coordinate space in order to superimpose markers and overlays. If you do not need offline map functionality, you can use the Snapshot class in MapboxStatic.swift to generate static map images with overlays.

    Example

    let camera = MGLMapCamera(lookingAtCenter: CLLocationCoordinate2D(latitude: 37.7184, longitude: -122.4365), fromDistance: 100, pitch: 20, heading: 0)
    
    let options = MGLMapSnapshotOptions(styleURL: MGLStyle.satelliteStreetsStyleURL(), camera: camera, size: CGSize(width: 320, height: 480))
    options.zoomLevel = 10
    
    let snapshotter = MGLMapSnapshotter(options: options)
    snapshotter.start { (snapshot, error) in
        if error != nil {
            // error handler
        } else {
            // image handler
        }
    }
    
    See more

    Declaration

    Objective-C

    
    @interface MGLMapSnapshotter : NSObject

    Swift

    class MGLMapSnapshotter : NSObject
  • An MGLConstantStyleValue object is a generic container for a style attribute value that remains constant as the zoom level changes. The layout and paint attribute properties of MGLStyleLayer objects can be set to MGLConstantStyleValue objects.

    The MGLConstantStyleValue class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

    See more

    Declaration

    Objective-C

    
    @interface MGLConstantStyleValue <T> : MGLStyleValue<T>

    Swift

    class MGLConstantStyleValue
  • An MGLStyleFunction is a is an abstract superclass for functions that are defined by an MGLCameraStyleFunction, MGLSourceStyleFunction, or MGLCompositeStyleFunction object.

    Create instances of MGLCameraStyleFunction, MGLSourceStyleFunction, and MGLCompositeStyleFunction in order to use MGLStyleFunction‘s methods. Do not create instances of MGLStyleFunction directly, and do not create your own subclasses of this class.

    The MGLStyleFunction class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

    See more

    Declaration

    Objective-C

    
    @interface MGLStyleFunction <T> : MGLStyleValue<T>

    Swift

    class MGLStyleFunction
  • An MGLCameraStyleFunction is a value function defining a style value that changes as the zoom level changes. The layout and paint attribute properties of an MGLStyleLayer object can be set to MGLCameraStyleFunction objects. Use a camera function to create the illusion of depth and control data density.

    The MGLCameraStyleFunction class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

    See more

    Declaration

    Objective-C

    
    @interface MGLCameraStyleFunction <T> : MGLStyleFunction<T>

    Swift

    class MGLCameraStyleFunction
  • An MGLSourceStyleFunction is a value function defining a style value that changes with its properties. The layout and paint attribute properties of an MGLStyleLayer object can be set to MGLSourceStyleFunction objects. Use source functions to visually differentate types of features within the same layer or create data visualizations.

    The MGLSourceStyleFunction class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

    See more

    Declaration

    Objective-C

    
    @interface MGLSourceStyleFunction <T> : MGLStyleFunction<T>

    Swift

    class MGLSourceStyleFunction
  • An MGLCompositeStyleFunction is a value function defining a style value that changes with the feature attributes at each map zoom level. The layout and paint attribute properties of an MGLStyleLayer object can be set to MGLCompositeStyleFunction objects. Use composite functions to allow the appearance of a map feature to change with both its attributes and the map zoom level.

    The MGLCompositeStyleFunction class takes a generic parameter T that indicates the Foundation class being wrapped by this class.

    See more

    Declaration

    Objective-C

    
    @interface MGLCompositeStyleFunction <T> : MGLStyleFunction<T>

    Swift

    class MGLCompositeStyleFunction